package com.xh.baselibrary.ex

import java.util.concurrent.locks.ReentrantLock

inline fun ReentrantLock.doLock(action: () -> Unit) {
    this.lock()
    try {
        action()
    } finally {
        this.unlock()
    }
}

inline fun onInterrupted(action: () -> Unit) {
    try {
        action()
    }catch (e :InterruptedException ){
        e.printStackTrace()
    }
}
